package com.bdqn.carrental.controller;

import com.bdqn.carrental.pojo.OrdersEntity;
import com.bdqn.carrental.service.OrdersServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
@RequestMapping(value = "/Orders")
public class OrdersController {
    @Autowired
    OrdersServiceImpl ordersService;
    private String meg = null;

    /**
     * 客户根据电话查询
     */
/*  @RequestMapping(value = "/OrdersName",method = RequestMethod.GET)
    public String  CustomerEntityList(Model model, @RequestParam(value = "name",required=false)String name,
                                      @RequestParam(value = "pageNum",required = false)String _pageNum ) {
        Integer pageNum=1;
        if(_pageNum!=null){
            pageNum=Integer.parseInt(_pageNum);
        }
        //引入分页查询，使用PageHelper分页功能
        //在查询之前传入当前页，然后多少记录
        PageHelper.startPage(pageNum,4);
      List<OrdersEntity> lists =ordersService.SelectOrders(name);
        //使用PageInfo包装查询结果，只需要将pageInfo交给页面就可以
        PageInfo<OrdersEntity> page=new PageInfo<OrdersEntity>(lists);
        model.addAttribute("pageInfo",page);
  *//*      model.addAttribute("meg",meg);
        meg=null;*//*
        return "yg-jbdd";
    }*/
    @RequestMapping(value = "/OrdersName", method = RequestMethod.GET)
    public String CustomerEntityList(Model model) {
        List<OrdersEntity> list = ordersService.finall();
        model.addAttribute("list",list);
        return "yg-jbdd";
    }
}
